package Test.designmodel.prototype;

/**
 * @Title: ecology-idea
 * @Company: 泛微软件
 * @author: weaver.Dusongsong
 * @version: 1.0
 * @CreateDate: 2022-05-18
 * @Description: ${description}
 * @ModifyLog:
 **/

public class ProtoTypeDemo {

    public static void main(String[] args) throws CloneNotSupportedException {
        Citation citation1 = new Citation("张三", "同学：在2016学年第一学期中表现优秀，被评为三好学生。", "韶关学院");
        citation1.display();
        Citation citation2 = (Citation)citation1.clone();
        citation2.setName( "李四");
        citation2.display();
    }

}

class Citation implements Cloneable{
    String name;
    String info;
    String college;

     Citation(String name, String info, String college) {
        this.name = name;
        this.info = info;
        this.college = college;
    }

     String getName() {
        return name;
    }

     void setName(String name) {
        this.name = name;
    }

     void display(){
         System.out.println(name + info + college);
     }

     public Object clone() throws CloneNotSupportedException{
         System.out.println("奖状拷贝成功！");
         return (Citation) super.clone();
     }
}
